<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
    <meta charset="utf-8">
    <title>书籍信息管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../layui/css/layui.css" media="all">
    <style>
        .systemnovel-con .layui-table-view {
            border: none;
        }
        
        .systemnovel-con .layui-table-box {
            margin-top: 10px;
        }
        
        .systemnovel-con {
            padding: 0 15px 15px 15px;
            margin-bottom: 50px;
        }
        
        .systemnovel-con .layui-table-tool-self {
            display: none;
        }
        
        .systemnovel-con .not_border_left {
            border-left: none !important;
        }
        
        .systemnovel-con .hide {
            display: none;
        }
        
        .systemnovel-con .show {
            display: block;
        }
        
        .systemnovel-con .btn_size {
            height: 28px !important;
            line-height: 28px !important;
        }
        
        .systemnovel-con .layui-table-body table tbody .layui-table-hover {
            background: #fffdd3 !important;
        }
        
        .systemnovel-con .layui-table-body table tbody .layui-table-click {
            background: #fdef9b !important;
        }
        
        .systemnovel-con .layui-table,
        .layui-table-view {
            border: none;
            margin-top: 0;
        }
        
        .adminuserdetail {
            padding: 20px;
            display: none;
        }
        
        .adminuserdetail table tr td {
            padding: 15px;
            text-align: center;
        }
        
        .adminuserdetail .tdbck {
            background: #f2f2f2;
            width: 30%;
        }
    </style>
</head>

<body>
	<!--弹框调用内容Start-->
	<div id="adminuserdetail" class="adminuserdetail">			
		<table class="layui-table">
		    <tbody>
		      <tr>
		        <td class="tdbck">章节名称</td>
		        <td><span id="txtclaid"></span></td>
		      </tr>
		      <tr>
		        <td class="tdbck">章节编号</td>
		        <td><span id="txtadminuserrealname"></span></td>
		      </tr>
		      <tr>
		        <td class="tdbck">所属小说名称</td>
		        <td><span id="txtadminuserusertype"></span></td>
		      </tr>
		      <tr>
		        <td class="tdbck">所属小说编号</td>
		        <td colspan="4"><span id="txtadminuserdesc"></span></td>
		      </tr>
		      <tr>
		        <td class="tdbck">作者</td>
		        <td><span id="txtadmincreatetime"></span></td>
		      </tr>
		      <tr>
		        <td class="tdbck">小说类型</td>
		        <td><span id="txtnoveltype"></span></td>
		      </tr>
		      <tr>
		        <td class="tdbck">章节内容</td>
		        <td><span id="txtnovelcontent"></span></td>
		      </tr>
		    </tbody>
		  </table>
	</div>
	<!--弹框调用内容END-->
	
    <div class="systemnovel-con">
        <blockquote class="layui-elem-quote not_border_left">
            <form class="layui-form" action="">
                <div class="layui-input-inline">
                    <input type="text" name="novelName" id="novelName" placeholder="请输入书籍名称" class="layui-input" autocomplete="off">
                </div>
                <div class="layui-input-inline">
                    <input type="text" name="chapterName" id="chapterName" placeholder="请输入章节名称" class="layui-input" autocomplete="off">
                </div>
                <span class="layui-input-inline">创建时间：</span> 
				<div class="layui-input-inline">
					<input type="text" name="starttime" id="starttime" placeholder="yyyy-MM-dd" class="layui-input" autocomplete="off">
				</div>
				<span class="layui-input-inline">--</span> 
				<div class="layui-input-inline">
					 <input type="text" name="endtime" id="endtime" placeholder="yyyy-MM-dd" class="layui-input" autocomplete="off">
				</div>
                <div class="layui-inline">
                    <button id="btnselfrontinfo" type="button" class="layui-btn layui-bg-blue">查询</button>
                </div>
            </form>
        </blockquote>

        <script type="text/html" id="barDemo">
            <a class="layui-btn layui-btn-xs" lay-event="selnovel">查看</a>
            <input type="checkbox" name="{{d.deepth}}" value="{{d.chapterid}}" title="通过审核" lay-filter="lockDemo" {{ d.auditstatus=="1" ? 'checked' : '' }}>
		</script>

        <!-- 表格开始 -->
        <table class="layui-hide" name="novelcontenttable" id="novelcontenttable" lay-filter="novelcontenttable"></table>
        <!-- 表格结束 -->

    </div>
    <script src="../js/jquery-3.3.1.js" charset="utf-8"></script>
    <script src="../layui/layui.js" charset="utf-8"></script>
    <script src="../js/loadselect.js" charset="utf-8"></script>
    <script>
        layui.use(['table', 'form', 'layer', 'laydate', 'laytpl', 'element'], function() {
            var table = layui.table,
                form = layui.form,
                layer = layui.layer,
                $ = layui.jquery,
                laydate = layui.laydate,
                laytpl = layui.laytpl,
                element = layui.element;
			
			/*时间控件*/
			laydate.render({
   			 	elem: '#starttime'
 			 });
 			 laydate.render({
   			 	elem: '#endtime'
 			 });
 			 
            /*加载表格*/
            table.render({
                elem: '#novelcontenttable',
                id: 'novelcontenttableid',
                url: '../getnovelcontent',
                title: '后台章节信息数据表',
                height: "full-160",
                skin: 'line',
                even: true,
                cols: [
                    [{
						type : 'numbers',
						title : '序号',
						align : 'center',
						width : 80
					},{
                        field: 'chaptername',
                        align: 'center',
                        title: '章节名称',
                    },{
                        field: 'chapterid',
                        align: 'center',
                        title: '章节编号',
                        width:100
                    }, {
                        field: 'novelname',
                        align: 'center',
                        title: '所属小说名称',
                    },{
                        field: 'novelid',
                        align: 'center',
                        title: '所属小说编号',
                    },{
                        field: 'nickname',
                        align: 'center',
                        title: '作者',
                    }, {
                        field: 'typename',
                        align: 'center',
                        title: '小说类型',
                    },  {
                        field: 'textcontent',
                        align: 'center',
                        title: '章节内容'
                    },{
                        field: 'createtime',
                        align: 'center',
                        title: '创建时间'
                    },{
                        title: '操作',
                        toolbar: '#barDemo',
                        align: 'center',
                        width:260
                    }]
                ],
                page: {
                    layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'],
                    groups: 5,
                    limit: 10,
                    limits: [10, 20, 30, 40, 50],
                    theme: '#1E9FFF',
                },
            });
            /*加载表格结束*/

            /* 点击查询对网站用户进行筛选 */
			$("#btnselfrontinfo").click(function() {
				table.reload('novelcontenttableid', {
					method : 'post',
					where : {
						'novelname' : $("#novelName").val().trim(),
						'chaptername' : $("#chapterName").val().trim(),
						'starttime' : $("#starttime").val().trim(),
						'endtime' : $("#endtime").val().trim(),
							},
					page : {
						curr : 1
						}
				});
			})
            /*点击查询加载表格数据结束*/
            
            //表格工具栏事件 
		table.on('tool(novelcontenttable)',function(obj) {
			 var data = obj.data;
			$("#txtclaid").text(data.chaptername);
			$("#txtadminuserrealname").text(data.chapterid);
			$("#txtadminuserusertype").text(data.novelname);
			$("#txtadminuserdesc").text(data.novelid);
			$("#txtadmincreatetime").text(data.nickname);
			$("#txtnoveltype").text(data.typename);
			$("#txtnovelcontent").text(data.textcontent);
			switch (obj.event) {
				case 'selnovel':
					layer.open({
				        type: 1, 
				        title: '章节信息详情',
				        area: ['600px', '500px'],
				        shade: 0.8,
				        content: $('#adminuserdetail'),
				        btn: ['返回'], 
				        yes: function(){
				          layer.closeAll();
				          $(".adminuserdetail").css("display","none");
				        },
				        cancel: function(){ 
						  $(".adminuserdetail").css("display","none");
						}
				    });
				break;
			}
        });
        
    //取消或通过审核
	form.on('checkbox(lockDemo)', function(obj) {
		//obj代表当前checkbox所在行的数据对象
		if(obj.elem.checked){ //但obj.elem.checked==true
			//还要再获取当前行的值
			//alert("check=" +obj.elem.checked)
			$.ajax({
				type : 'get',
				url : '../passnovelcontent?chapterid=' + this.value,
				datatype : 'json',
				success : function(data) {
					if (data.code == "0") {		
						layer.msg('审核成功！', {icon: 1}); 
					} else {
	    	        	layer.msg('审核失败！', {icon: 2});
					}
				},
				error : function() {}
			});
		}
		else{
			$.ajax({
				type : 'get',
				url : '../notpassnovelcontent?chapterid=' + this.value,
				datatype : 'json',
				success : function(data) {
					if (data.code == "0") {	
						layer.msg('取消审核成功！', {icon: 1}); 				
					} else {
						layer.msg('取消审核失败！', {icon: 2}); 
					}
				},
				error : function() {}
			});
		}				
	});
    });
    </script>
</body>

</html>